#include"ShareMemory.hpp"


int main()
{
    //获取共享内存
    shm.GetShm();

    //挂接共享内存
    shm.AttachShm();

    //获取地址
    char *in = (char*)shm.GetAddr();

    while(true)
    {
        //输入
        std::string s;
        std::cin>>s;
        //拷贝到内存中
        strncpy(in,s.c_str(),s.size()+1);
        sleep(1);
    }

    
    //取消挂接
    shm.DetachShm();


    return 0;
}
